
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Gradle · GitBook笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="chenjiebin">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../framework/kubernate.html" />
    
    
    <link rel="prev" href="maven.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../document/kubernetes/kubernetes.html">
            
                <a href="../document/kubernetes/kubernetes.html">
            
                    
                    Kubernetes英文教程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../document/kubernetes/kubernetes.html">
            
                <a href="../document/kubernetes/kubernetes.html#concepts">
            
                    
                    Kubernetes Concepts
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="../document/kubernetes/concepts/overview.html">
            
                <a href="../document/kubernetes/concepts/overview.html">
            
                    
                    Kubernetes Overview
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="../document/kubernetes/concepts/components.html">
            
                <a href="../document/kubernetes/concepts/components.html">
            
                    
                    Kubernetes Components
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.3" data-path="../document/kubernetes/concepts/nodes.html">
            
                <a href="../document/kubernetes/concepts/nodes.html">
            
                    
                    Kubernetes Nodes
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../document/kubernetes/kubernetes.html">
            
                <a href="../document/kubernetes/kubernetes.html#tutorial">
            
                    
                    Kubernetes Tutorial
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../document/kubernetes/tutorial/kubernetes-basics.html">
            
                <a href="../document/kubernetes/tutorial/kubernetes-basics.html">
            
                    
                    Kubernetes Basics
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../java/java.html">
            
                <a href="../java/java.html">
            
                    
                    Java基础知识
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../java/java-summary.html">
            
                <a href="../java/java-summary.html">
            
                    
                    Java_Summary
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../java/java-jvm.html">
            
                <a href="../java/java-jvm.html">
            
                    
                    Java_JVM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../java/effectiveJava.html">
            
                <a href="../java/effectiveJava.html">
            
                    
                    effectiveJava
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../java/design-pattern.html">
            
                <a href="../java/design-pattern.html">
            
                    
                    设计模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../java/JavaTest.html">
            
                <a href="../java/JavaTest.html">
            
                    
                    JavaTest
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../java/myframe.html">
            
                <a href="../java/myframe.html">
            
                    
                    MyFrame
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../database/database.html">
            
                <a href="../database/database.html">
            
                    
                    数据库基础知识
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../database/mysql.html">
            
                <a href="../database/mysql.html">
            
                    
                    MySQL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../database/redis.html">
            
                <a href="../database/redis.html">
            
                    
                    Redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../database/kingbase.html">
            
                <a href="../database/kingbase.html">
            
                    
                    KingBase
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../database/polardb.html">
            
                <a href="../database/polardb.html">
            
                    
                    PolarDB
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../system/system.html">
            
                <a href="../system/system.html">
            
                    
                    环境配置工具
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../system/nodejs.html">
            
                <a href="../system/nodejs.html">
            
                    
                    Node.js
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../system/gitbook.html">
            
                <a href="../system/gitbook.html">
            
                    
                    Gitbook
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../system/linux.html">
            
                <a href="../system/linux.html">
            
                    
                    Linux
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../system/kylin.html">
            
                <a href="../system/kylin.html">
            
                    
                    麒麟系统
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="tool.html">
            
                <a href="tool.html">
            
                    
                    开发工具介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="docker.html">
            
                <a href="docker.html">
            
                    
                    Docker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="idea.html">
            
                <a href="idea.html">
            
                    
                    Idea
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="maven.html">
            
                <a href="maven.html">
            
                    
                    Maven
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.6.4" data-path="gradle.html">
            
                <a href="gradle.html">
            
                    
                    Gradle
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../framework/kubernate.html">
            
                <a href="../framework/kubernate.html">
            
                    
                    Kubernetes
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >Gradle</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#gradle"><b>1. </b>Gradle</a></li><ul><li><span class="title-icon "></span><a href="#gradle-&#x6982;&#x8FF0;"><b>1.1. </b>Gradle &#x6982;&#x8FF0;</a></li><li><span class="title-icon "></span><a href="#gradle-&#x5B89;&#x88C5;"><b>1.2. </b>Gradle &#x5B89;&#x88C5;</a></li><li><span class="title-icon "></span><a href="#gradle-&#x4ED3;&#x5E93;"><b>1.3. </b>Gradle &#x4ED3;&#x5E93;</a></li><li><span class="title-icon "></span><a href="#gradle-cache"><b>1.4. </b>Gradle cache</a></li></ul><li><span class="title-icon "></span><a href="#idea"><b>2. </b>IDEA</a></li><ul><li><span class="title-icon "></span><a href="#idea&#x4E71;&#x7801;"><b>2.1. </b>idea&#x4E71;&#x7801;</a></li></ul><li><span class="title-icon "></span><a href="#gradle&#x6784;&#x5EFA;&#x57FA;&#x7840;"><b>3. </b>Gradle&#x6784;&#x5EFA;&#x57FA;&#x7840;</a></li><ul><li><span class="title-icon "></span><a href="#&#x5B9A;&#x4E49;&#x4EFB;&#x52A1;"><b>3.1. </b>&#x5B9A;&#x4E49;&#x4EFB;&#x52A1;</a></li><li><span class="title-icon "></span><a href="#&#x4F7F;&#x7528;groovy"><b>3.2. </b>&#x4F7F;&#x7528;groovy</a></li><li><span class="title-icon "></span><a href="#&#x4EFB;&#x52A1;&#x4F9D;&#x8D56;"><b>3.3. </b>&#x4EFB;&#x52A1;&#x4F9D;&#x8D56;</a></li><li><span class="title-icon "></span><a href="#&#x5EF6;&#x8FDF;&#x4F9D;&#x8D56;"><b>3.4. </b>&#x5EF6;&#x8FDF;&#x4F9D;&#x8D56;</a></li><li><span class="title-icon "></span><a href="#&#x52A8;&#x6001;&#x4EFB;&#x52A1;"><b>3.5. </b>&#x52A8;&#x6001;&#x4EFB;&#x52A1;</a></li><li><span class="title-icon "></span><a href="#&#x81EA;&#x5B9A;&#x4E49;&#x5C5E;&#x6027;"><b>3.6. </b>&#x81EA;&#x5B9A;&#x4E49;&#x5C5E;&#x6027;</a></li></ul><li><span class="title-icon "></span><a href="#gradle&#x6784;&#x5EFA;&#x5165;&#x95E8;"><b>4. </b>Gradle&#x6784;&#x5EFA;&#x5165;&#x95E8;</a></li><ul><li><span class="title-icon "></span><a href="#java&#x63D2;&#x4EF6;"><b>4.1. </b>Java&#x63D2;&#x4EF6;</a></li><li><span class="title-icon "></span><a href="#&#x6784;&#x5EFA;&#x9879;&#x76EE;"><b>4.2. </b>&#x6784;&#x5EFA;&#x9879;&#x76EE;</a></li><li><span class="title-icon "></span><a href="#&#x5916;&#x90E8;&#x4F9D;&#x8D56;"><b>4.3. </b>&#x5916;&#x90E8;&#x4F9D;&#x8D56;</a></li><li><span class="title-icon "></span><a href="#&#x5305;&#x4F9D;&#x8D56;"><b>4.4. </b>&#x5305;&#x4F9D;&#x8D56;</a></li></ul><li><span class="title-icon "></span><a href="#&#x53C2;&#x8003;"><b>5. </b>&#x53C2;&#x8003;</a></li></ul></div><a href="#gradle" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="gradle"><a name="gradle" class="anchor-navigation-ex-anchor" href="#gradle"><i class="fa fa-link" aria-hidden="true"></i></a>1. Gradle</h1>
<h2 id="gradle-&#x6982;&#x8FF0;"><a name="gradle-&#x6982;&#x8FF0;" class="anchor-navigation-ex-anchor" href="#gradle-&#x6982;&#x8FF0;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1. Gradle &#x6982;&#x8FF0;</h2>
<p>Gradle&#x662F;&#x4E00;&#x4E2A;&#x57FA;&#x4E8E;JVM&#xFF0C;&#x7528;Groovy&#x8BED;&#x8A00;&#x7F16;&#x5199;&#x7684;&#x6784;&#x5EFA;&#x5DE5;&#x5177;&#xFF0C;&#x662F;&#x4E00;&#x6B3E;&#x901A;&#x7528;&#x7075;&#x6D3B;&#x7684;&#x6784;&#x5EFA;&#x5DE5;&#x5177;</p>
<p>&#x652F;&#x6301;maven&#xFF0C;ivy&#x4ED3;&#x5E93;&#xFF0C;&#x652F;&#x6301;&#x4F20;&#x9012;&#x6027;&#x4F9D;&#x8D56;&#x7BA1;&#x7406;&#xFF0C;&#x800C;&#x4E0D;&#x9700;&#x8981;&#x8FDC;&#x7A0B;&#x4ED3;&#x5E93;&#x6216;&#x8005;&#x662F;pom.xml&#x914D;&#x7F6E;&#x6587;&#x4EF6;</p>
<h2 id="gradle-&#x5B89;&#x88C5;"><a name="gradle-&#x5B89;&#x88C5;" class="anchor-navigation-ex-anchor" href="#gradle-&#x5B89;&#x88C5;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2. Gradle &#x5B89;&#x88C5;</h2>
<p>&#x4EE5;&#x4E0B;&#x914D;&#x7F6E;&#x57FA;&#x4E8E;windows10</p>
<p>&#x4E0B;&#x8F7D;&#x5730;&#x5740;&#xFF1A;<a href="https://gradle.org/releases/" target="_blank">Gradle | Releases</a></p>
<p>&#x89E3;&#x538B;&#x6587;&#x4EF6;&#xFF1A;D:\Program\Apache\gradle-7.2</p>
<p>&#x73AF;&#x5883;&#x53D8;&#x91CF;&#xFF1A;D:\Program\Apache\gradle-7.2\bin&#xFF08;path&#x53D8;&#x91CF;&#x6DFB;&#x52A0;&#xFF09;</p>
<p>&#x6D4B;&#x8BD5;&#x547D;&#x4EE4;&#xFF1A;gradle -version &#x6216; gradle -v</p>
<p>&#x4ED3;&#x5E93;&#x4F4D;&#x7F6E;&#xFF1A;C:\Users\ASUS.gradle\caches\modules-2\files-2.1</p>
<p>&#x4FEE;&#x6539;&#x4F4D;&#x7F6E;&#xFF1A;<code>GRADLE_USER_HOME&#xFF1A;D:\Program\Apache\.gradle</code></p>
<h2 id="gradle-&#x4ED3;&#x5E93;"><a name="gradle-&#x4ED3;&#x5E93;" class="anchor-navigation-ex-anchor" href="#gradle-&#x4ED3;&#x5E93;"><i class="fa fa-link" aria-hidden="true"></i></a>1.3. Gradle &#x4ED3;&#x5E93;</h2>
<p>Gradle&#x3001;Maven&#x7684;&#x9ED8;&#x8BA4;&#x4E2D;&#x592E;&#x4ED3;&#x5E93;&#x662F; <a href="http://repo1.maven.org/maven2/" target="_blank">http://repo1.maven.org/maven2/</a></p>
<p>&#x9879;&#x76EE;&#x4E2D;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x56FD;&#x5185;&#x955C;&#x50CF;&#x8FDB;&#x884C;&#x52A0;&#x901F;</p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Real URL</th>
<th>Use URL</th>
</tr>
</thead>
<tbody>
<tr>
<td>mavenLocal</td>
<td>local</td>
<td></td>
<td></td>
</tr>
<tr>
<td>jcenter</td>
<td>JFrog Offers</td>
<td><a href="http://jcenter.bintray.com" target="_blank">http://jcenter.bintray.com</a></td>
<td><a href="https://maven.aliyun.com/repository/jcenter" target="_blank">https://maven.aliyun.com/repository/jcenter</a></td>
</tr>
<tr>
<td>mavenCentral</td>
<td>Sonatype Offers</td>
<td><a href="https://repo1.maven.org/maven2/" target="_blank">https://repo1.maven.org/maven2/</a></td>
<td><a href="https://maven.aliyun.com/repository/central" target="_blank">https://maven.aliyun.com/repository/central</a></td>
</tr>
<tr>
<td>public</td>
<td>jcenter+mavenCentral</td>
<td></td>
<td><a href="https://maven.aliyun.com/repository/public" target="_blank">https://maven.aliyun.com/repository/public</a></td>
</tr>
<tr>
<td>google</td>
<td>Google Offers</td>
<td><a href="https://maven.google.com" target="_blank">https://maven.google.com</a></td>
<td><a href="https://maven.aliyun.com/repository/google" target="_blank">https://maven.aliyun.com/repository/google</a></td>
</tr>
<tr>
<td>jitpack</td>
<td>JitPack Offers</td>
<td><a href="https://jitpack.io" target="_blank">https://jitpack.io</a></td>
<td><a href="https://jitpack.io" target="_blank">https://jitpack.io</a></td>
</tr>
<tr>
<td>gradle-plugin</td>
<td>gradle plugin</td>
<td><a href="https://plugins.gradle.org/m2" target="_blank">https://plugins.gradle.org/m2</a></td>
<td><a href="https://maven.aliyun.com/repository/gradle-plugin" target="_blank">https://maven.aliyun.com/repository/gradle-plugin</a></td>
</tr>
</tbody>
</table>
<p>&#x5982;&#x679C;&#x6240;&#x6709;&#x9879;&#x76EE;&#x90FD;&#x662F;&#x7528;&#x56FD;&#x5185;&#x955C;&#x50CF;&#xFF0C;&#x53EF;&#x4EE5;&#x8FDB;&#x884C;&#x7EDF;&#x4E00;&#x914D;&#x7F6E; GRADLE_HOME/init.d/init.gradle</p>
<pre class="language-"><code class="lang-groovy">allprojects <span class="token punctuation">{</span>
    repositories <span class="token punctuation">{</span>
        <span class="token function">mavenLocal</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
        maven <span class="token punctuation">{</span> url <span class="token interpolation-string"><span class="token string">&quot;https://maven.aliyun.com/repository/public&quot;</span></span> <span class="token punctuation">}</span>
        maven <span class="token punctuation">{</span> url <span class="token interpolation-string"><span class="token string">&quot;https://maven.aliyun.com/repository/google&quot;</span></span> <span class="token punctuation">}</span>
        maven <span class="token punctuation">{</span> url <span class="token interpolation-string"><span class="token string">&quot;https://plugins.gradle.org/m2&quot;</span></span> <span class="token punctuation">}</span>
        maven <span class="token punctuation">{</span> url <span class="token interpolation-string"><span class="token string">&quot;https://jitpack.io&quot;</span></span> <span class="token punctuation">}</span>
        maven <span class="token punctuation">{</span> url <span class="token interpolation-string"><span class="token string">&quot;https://maven.aliyun.com/repository/gradle-plugin&quot;</span></span> <span class="token punctuation">}</span>
        <span class="token function">mavenCentral</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token comment">// https://repo1.maven.org/maven2/</span>
    <span class="token punctuation">}</span>

    buildscript <span class="token punctuation">{</span>
        repositories <span class="token punctuation">{</span>
            <span class="token function">mavenLocal</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
            maven <span class="token punctuation">{</span> url <span class="token interpolation-string"><span class="token string">&quot;https://maven.aliyun.com/repository/public&quot;</span></span> <span class="token punctuation">}</span>
            maven <span class="token punctuation">{</span> url <span class="token interpolation-string"><span class="token string">&quot;https://maven.aliyun.com/repository/google&quot;</span></span> <span class="token punctuation">}</span>
            maven <span class="token punctuation">{</span> url <span class="token interpolation-string"><span class="token string">&quot;https://plugins.gradle.org/m2&quot;</span></span> <span class="token punctuation">}</span>
            maven <span class="token punctuation">{</span> url <span class="token interpolation-string"><span class="token string">&quot;https://jitpack.io&quot;</span></span> <span class="token punctuation">}</span>
            maven <span class="token punctuation">{</span> url <span class="token interpolation-string"><span class="token string">&quot;https://maven.aliyun.com/repository/gradle-plugin&quot;</span></span> <span class="token punctuation">}</span>
            <span class="token function">mavenCentral</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token comment">// https://repo1.maven.org/maven2/</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<h2 id="gradle-cache"><a name="gradle-cache" class="anchor-navigation-ex-anchor" href="#gradle-cache"><i class="fa fa-link" aria-hidden="true"></i></a>1.4. Gradle cache</h2>
<p>&#x9ED8;&#x8BA4; gradle &#x5B58;&#x50A8;&#x8DEF;&#x5F84;&#x4E3A; USER_HOME/.gradle, &#x53EF;&#x4EE5;&#x5728;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x6DFB;&#x52A0; GRADLE_USER_HOME &#x6765;&#x4FEE;&#x6539; .gradle &#x7684;&#x5B58;&#x50A8;&#x4F4D;&#x7F6E;</p>
<p>|--- daemon         Gradle&#x65E5;&#x5FD7;&#x76EE;&#x5F55;
|--- native         Gradle&#x5E73;&#x53F0;&#x76F8;&#x5173;&#x76EE;&#x5F55;
|--- gradle-wrapper Gradle-Wrapper&#x4E0B;&#x8F7D;&#x76EE;&#x5F55;
|--- caches         Gradle&#x7F13;&#x5B58;&#x76EE;&#x5F55;
 |--- 7.4             Gradle&#x7A0B;&#x5E8F;&#x7248;&#x672C;&#x7684;&#x811A;&#x672C;
 |--- jars-1          Gradle&#x7A0B;&#x5E8F;&#x7248;&#x672C;&#x7684;&#x811A;&#x672C;
 |--- jars-9          Gradle&#x7A0B;&#x5E8F;&#x7248;&#x672C;&#x7684;&#x811A;&#x672C;
 |--- modules-2       Gradle&#x4E0B;&#x8F7D;&#x7F13;&#x5B58;&#x76EE;&#x5F55;
   |--- metadata-2.x    Gradle&#x63CF;&#x8FF0;&#x6587;&#x4EF6;
   |--- files-2.1       Gradle&#x4E0B;&#x8F7D;jar&#x5B58;&#x653E;&#x76EE;&#x5F55;</p>
<blockquote>
<p>files-2.1&#x6587;&#x4EF6;&#x5B58;&#x653E;&#x89C4;&#x5219;:</p>
</blockquote>
<p>${groupId}/${artifactId}/${version}/${shaNum}/${groupId-artifactId-version}.jar/pom</p>
<h1 id="idea"><a name="idea" class="anchor-navigation-ex-anchor" href="#idea"><i class="fa fa-link" aria-hidden="true"></i></a>2. IDEA</h1>
<h2 id="idea&#x4E71;&#x7801;"><a name="idea&#x4E71;&#x7801;" class="anchor-navigation-ex-anchor" href="#idea&#x4E71;&#x7801;"><i class="fa fa-link" aria-hidden="true"></i></a>2.1. idea&#x4E71;&#x7801;</h2>
<p>Help -&gt; Edit Custom VM Options</p>
<pre class="language-"><code class="lang-shell"><span class="token comment"># idea64.exe.vmoptions&#x6DFB;&#x52A0;encoding</span>
<span class="token parameter variable">-Dfile.encoding</span><span class="token operator">=</span>UFT-8
</code></pre>
<h1 id="gradle&#x6784;&#x5EFA;&#x57FA;&#x7840;"><a name="gradle&#x6784;&#x5EFA;&#x57FA;&#x7840;" class="anchor-navigation-ex-anchor" href="#gradle&#x6784;&#x5EFA;&#x57FA;&#x7840;"><i class="fa fa-link" aria-hidden="true"></i></a>3. Gradle&#x6784;&#x5EFA;&#x57FA;&#x7840;</h1>
<h2 id="&#x5B9A;&#x4E49;&#x4EFB;&#x52A1;"><a name="&#x5B9A;&#x4E49;&#x4EFB;&#x52A1;" class="anchor-navigation-ex-anchor" href="#&#x5B9A;&#x4E49;&#x4EFB;&#x52A1;"><i class="fa fa-link" aria-hidden="true"></i></a>3.1. &#x5B9A;&#x4E49;&#x4EFB;&#x52A1;</h2>
<pre class="language-"><code class="lang-groovy">task hello <span class="token punctuation">{</span>
    println <span class="token string">&apos;hello world!&apos;</span>
<span class="token punctuation">}</span>
</code></pre>
<blockquote>
<p>&#x6267;&#x884C;&#x4EFB;&#x52A1;</p>
</blockquote>
<pre class="language-"><code class="lang-bash">gradle <span class="token parameter variable">-q</span> hello
</code></pre>
<h2 id="&#x4F7F;&#x7528;groovy"><a name="&#x4F7F;&#x7528;groovy" class="anchor-navigation-ex-anchor" href="#&#x4F7F;&#x7528;groovy"><i class="fa fa-link" aria-hidden="true"></i></a>3.2. &#x4F7F;&#x7528;groovy</h2>
<pre class="language-"><code class="lang-groovy">task hello <span class="token punctuation">{</span>
    String str <span class="token operator">=</span> <span class="token string">&apos;mY_nAmE&apos;</span>
    println <span class="token interpolation-string"><span class="token string">&quot;Original:&quot;</span></span> <span class="token operator">+</span> str
    println <span class="token interpolation-string"><span class="token string">&quot;Upper case:&quot;</span></span> <span class="token operator">+</span> str<span class="token punctuation">.</span><span class="token function">toUpperCase</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
    <span class="token number">4</span><span class="token punctuation">.</span>times <span class="token punctuation">{</span> print <span class="token interpolation-string"><span class="token string">&quot;</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">$</span><span class="token expression">it</span></span><span class="token string"> &quot;</span></span><span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<h2 id="&#x4EFB;&#x52A1;&#x4F9D;&#x8D56;"><a name="&#x4EFB;&#x52A1;&#x4F9D;&#x8D56;" class="anchor-navigation-ex-anchor" href="#&#x4EFB;&#x52A1;&#x4F9D;&#x8D56;"><i class="fa fa-link" aria-hidden="true"></i></a>3.3. &#x4EFB;&#x52A1;&#x4F9D;&#x8D56;</h2>
<pre class="language-"><code class="lang-groovy">task hello <span class="token punctuation">{</span>
    println <span class="token string">&apos;hello world!&apos;</span>
<span class="token punctuation">}</span>

task <span class="token function">intro</span><span class="token punctuation">(</span>dependsOn<span class="token punctuation">:</span> hello<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    println <span class="token interpolation-string"><span class="token string">&quot;I&apos;m Gradle&quot;</span></span>
<span class="token punctuation">}</span>
</code></pre>
<blockquote>
<p>&#x6267;&#x884C;&#x4EFB;&#x52A1;</p>
</blockquote>
<pre class="language-"><code class="lang-bash">gradle <span class="token parameter variable">-q</span> intro
</code></pre>
<h2 id="&#x5EF6;&#x8FDF;&#x4F9D;&#x8D56;"><a name="&#x5EF6;&#x8FDF;&#x4F9D;&#x8D56;" class="anchor-navigation-ex-anchor" href="#&#x5EF6;&#x8FDF;&#x4F9D;&#x8D56;"><i class="fa fa-link" aria-hidden="true"></i></a>3.4. &#x5EF6;&#x8FDF;&#x4F9D;&#x8D56;</h2>
<pre class="language-"><code class="lang-groovy">task <span class="token function">intro</span><span class="token punctuation">(</span>dependsOn<span class="token punctuation">:</span> <span class="token string">&apos;hello&apos;</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    println <span class="token interpolation-string"><span class="token string">&quot;I&apos;m Gradle&quot;</span></span>
<span class="token punctuation">}</span>

task hello <span class="token punctuation">{</span>
    println <span class="token string">&apos;hello world!&apos;</span>
<span class="token punctuation">}</span>
</code></pre>
<h2 id="&#x52A8;&#x6001;&#x4EFB;&#x52A1;"><a name="&#x52A8;&#x6001;&#x4EFB;&#x52A1;" class="anchor-navigation-ex-anchor" href="#&#x52A8;&#x6001;&#x4EFB;&#x52A1;"><i class="fa fa-link" aria-hidden="true"></i></a>3.5. &#x52A8;&#x6001;&#x4EFB;&#x52A1;</h2>
<pre class="language-"><code class="lang-groovy"><span class="token number">4</span><span class="token punctuation">.</span>times <span class="token punctuation">{</span> counter <span class="token operator">-&gt;</span>
    task <span class="token interpolation-string"><span class="token string">&quot;task</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">$</span><span class="token expression">counter</span></span><span class="token string">&quot;</span></span> <span class="token punctuation">{</span>
        println <span class="token interpolation-string"><span class="token string">&quot;I&apos;m task number </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">$</span><span class="token expression">counter</span></span><span class="token string">&quot;</span></span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<blockquote>
<p>&#x6267;&#x884C;&#x547D;&#x4EE4;</p>
</blockquote>
<pre class="language-"><code class="lang-bash">gradle <span class="token parameter variable">-q</span> task1
</code></pre>
<h2 id="&#x81EA;&#x5B9A;&#x4E49;&#x5C5E;&#x6027;"><a name="&#x81EA;&#x5B9A;&#x4E49;&#x5C5E;&#x6027;" class="anchor-navigation-ex-anchor" href="#&#x81EA;&#x5B9A;&#x4E49;&#x5C5E;&#x6027;"><i class="fa fa-link" aria-hidden="true"></i></a>3.6. &#x81EA;&#x5B9A;&#x4E49;&#x5C5E;&#x6027;</h2>
<pre class="language-"><code class="lang-groovy">task myTask <span class="token punctuation">{</span>
    ext<span class="token punctuation">.</span>myProperty <span class="token operator">=</span> <span class="token interpolation-string"><span class="token string">&quot;myValue&quot;</span></span>
<span class="token punctuation">}</span>

task hello <span class="token punctuation">{</span>
    println myTask<span class="token punctuation">.</span>myProperty
<span class="token punctuation">}</span>
</code></pre>
<h1 id="gradle&#x6784;&#x5EFA;&#x5165;&#x95E8;"><a name="gradle&#x6784;&#x5EFA;&#x5165;&#x95E8;" class="anchor-navigation-ex-anchor" href="#gradle&#x6784;&#x5EFA;&#x5165;&#x95E8;"><i class="fa fa-link" aria-hidden="true"></i></a>4. Gradle&#x6784;&#x5EFA;&#x5165;&#x95E8;</h1>
<h2 id="java&#x63D2;&#x4EF6;"><a name="java&#x63D2;&#x4EF6;" class="anchor-navigation-ex-anchor" href="#java&#x63D2;&#x4EF6;"><i class="fa fa-link" aria-hidden="true"></i></a>4.1. Java&#x63D2;&#x4EF6;</h2>
<blockquote>
<p>build.gradle</p>
</blockquote>
<pre class="language-"><code>apply plugin: &apos;java&apos;
</code></pre><h2 id="&#x6784;&#x5EFA;&#x9879;&#x76EE;"><a name="&#x6784;&#x5EFA;&#x9879;&#x76EE;" class="anchor-navigation-ex-anchor" href="#&#x6784;&#x5EFA;&#x9879;&#x76EE;"><i class="fa fa-link" aria-hidden="true"></i></a>4.2. &#x6784;&#x5EFA;&#x9879;&#x76EE;</h2>
<pre class="language-"><code class="lang-bash"><span class="token comment"># &#x6784;&#x5EFA;&#x9879;&#x76EE;</span>
gradle build
<span class="token comment"># &#x5220;&#x9664;&#x6587;&#x4EF6;</span>
gradle clean
<span class="token comment"># &#x7F16;&#x8BD1;&#x5E76;&#x6253;&#x5305;&#x6587;&#x4EF6;&#xFF0C;&#x4E0D;&#x6267;&#x884C;&#x5355;&#x5143;&#x6D4B;&#x8BD5;</span>
gradle assemble
<span class="token comment"># &#x7F16;&#x8BD1;&#x5E76;&#x6D4B;&#x8BD5;&#x4EE3;&#x7801;</span>
gradle check
</code></pre>
<h2 id="&#x5916;&#x90E8;&#x4F9D;&#x8D56;"><a name="&#x5916;&#x90E8;&#x4F9D;&#x8D56;" class="anchor-navigation-ex-anchor" href="#&#x5916;&#x90E8;&#x4F9D;&#x8D56;"><i class="fa fa-link" aria-hidden="true"></i></a>4.3. &#x5916;&#x90E8;&#x4F9D;&#x8D56;</h2>
<ul>
<li>&#x6DFB;&#x52A0;Maven&#x4ED3;&#x5E93;</li>
</ul>
<pre class="language-"><code class="lang-groovy">repositories <span class="token punctuation">{</span>
    <span class="token function">mavenCentral</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span>
</code></pre>
<ul>
<li>&#x6DFB;&#x52A0;&#x4F9D;&#x8D56;</li>
</ul>
<pre class="language-"><code class="lang-groovy">dependencies <span class="token punctuation">{</span>
    testImplementation group<span class="token punctuation">:</span> <span class="token string">&apos;junit&apos;</span><span class="token punctuation">,</span> name<span class="token punctuation">:</span> <span class="token string">&apos;junit&apos;</span><span class="token punctuation">,</span> version<span class="token punctuation">:</span> <span class="token string">&apos;4.13.2&apos;</span>
<span class="token punctuation">}</span>
</code></pre>
<h2 id="&#x5305;&#x4F9D;&#x8D56;"><a name="&#x5305;&#x4F9D;&#x8D56;" class="anchor-navigation-ex-anchor" href="#&#x5305;&#x4F9D;&#x8D56;"><i class="fa fa-link" aria-hidden="true"></i></a>4.4. &#x5305;&#x4F9D;&#x8D56;</h2>
<ul>
<li>implementation&#xFF1A;&#x5C06;&#x4F9D;&#x8D56;&#x6DFB;&#x52A0;&#x5230;&#x7F16;&#x8BD1;&#x8DEF;&#x5F84;&#xFF0C;&#x5E76;&#x6253;&#x5305;&#x5230;&#x6784;&#x5EFA;&#x8F93;&#x51FA;</li>
<li>api&#xFF1A;&#x5C06;&#x4F9D;&#x8D56;&#x6DFB;&#x52A0;&#x5230;&#x7F16;&#x8BD1;&#x7C7B;&#x8DEF;&#x5F84;&#x548C;&#x6784;&#x5EFA;&#x8F93;&#x51FA;</li>
<li>compileOnly&#xFF1A;&#x5C06;&#x4F9D;&#x8D56;&#x6DFB;&#x52A0;&#x5230;&#x7F16;&#x8BD1;&#x8DEF;&#x5F84;</li>
<li>annotaionProcessor&#xFF1A;&#x6CE8;&#x91CA;&#x5904;&#x7406;&#x5668;</li>
<li>lintChecks&#xFF1A;lint&#x68C0;&#x67E5;</li>
<li>linPublish&#xFF1A;</li>
</ul>
<h1 id="&#x53C2;&#x8003;"><a name="&#x53C2;&#x8003;" class="anchor-navigation-ex-anchor" href="#&#x53C2;&#x8003;"><i class="fa fa-link" aria-hidden="true"></i></a>5. &#x53C2;&#x8003;</h1>
<p><a href="https://www.cnblogs.com/lenmom/p/10364743.html" target="_blank">gradle&#x672C;&#x5730;&#x3001;&#x8FDC;&#x7A0B;&#x4ED3;&#x5E93;&#x914D;&#x7F6E; - &#x8001;&#x8463; - &#x535A;&#x5BA2;&#x56ED; (cnblogs.com)</a></p>
<p><a href="https://www.jianshu.com/p/d23ceed8f19d" target="_blank">Gradle Wrapper - &#x7B80;&#x4E66; (jianshu.com)</a></p>
<p><a href="https://www.jianshu.com/p/319e7a8faa6a" target="_blank">&#x4E00;&#x62DB;&#x89E3;&#x51B3;gradle&#x4F9D;&#x8D56;&#x5E93;&#x56FD;&#x5185;&#x4E0B;&#x8F7D;&#x4E0D;&#x4E86;&#x7684;&#x95EE;&#x9898; - &#x7B80;&#x4E66; (jianshu.com)</a></p>
<p><a href="https://blog.csdn.net/w605283073/article/details/89277969" target="_blank">&#x5982;&#x4F55;&#x641C;&#x7D22;maven&#x6216;&#x8005;gradle&#x7684;&#x4F9D;&#x8D56;&#x914D;&#x7F6E;&#x6216;&#x624B;&#x52A8;&#x4E0B;&#x8F7D;jar&#x5305;_&#x660E;&#x660E;&#x5982;&#x6708;&#x7684;&#x6280;&#x672F;&#x535A;&#x5BA2;-CSDN&#x535A;&#x5BA2;</a></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="maven.html" class="navigation navigation-prev " aria-label="Previous page: Maven">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../framework/kubernate.html" class="navigation navigation-next " aria-label="Next page: Kubernetes">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Gradle","level":"1.6.4","depth":2,"next":{"title":"Kubernetes","level":"1.6.5","depth":2,"path":"markdown/framework/kubernate.md","ref":"markdown/framework/kubernate.md","articles":[]},"previous":{"title":"Maven","level":"1.6.3","depth":2,"path":"markdown/tool/maven.md","ref":"markdown/tool/maven.md","articles":[]},"dir":"ltr"},"config":{"plugins":["theme-default","prism","-highlight","search-pro","-search","-lunr","expandable-chapters-small","splitter","-sharing","anchor-navigation-ex","code"],"styles":{"ebook":"styles/ebook.css","epub":"styles/epub.css","mobi":"styles/mobi.css","pdf":"styles/pdf.css","print":"styles/print.css","website":"styles/website.css"},"pluginsConfig":{"prism":{},"search-pro":{},"expandable-chapters-small":{},"splitter":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"code":{"copyButtons":true},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"showLevel":false,"styles":{"ebook":"styles/ebook.css","epub":"styles/epub.css","mobi":"styles/mobi.css","pdf":"styles/pdf.css","print":"styles/print.css","website":"styles/website.css"}}},"theme":"default","author":"chenjiebin","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pluginConfig":{"prism":{"css":["prismjs/themes/prism-solarizedlight.css"]},"anchor-navigation-ex":{"showLevel":true},"theme-default":{"toggleMenu":false}},"variables":{},"title":"GitBook笔记","gitbook":"*","description":"学习笔记，包含前后端基础知识及框架的学习笔记"},"file":{"path":"markdown/tool/gradle.md","mtime":"2023-12-08T07:05:51.503Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2024-02-28T09:32:04.838Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

